package com.xuanxing123.model;

import org.compass.annotations.Searchable;
import org.compass.annotations.SearchableId;
import org.compass.annotations.SearchableProperty;

import javax.persistence.*;
import static javax.persistence.GenerationType.IDENTITY;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;

@Entity
@Table(name="brand",catalog="xuanxing")
@Searchable
@XmlRootElement
public class Brand extends BaseObject implements Serializable {
    private Long id;
    private Integer version;
    private String name;
    private String comments;
    private String description;
    private Integer companyType;
    private String website;
    private String phone;
    private String logo;
    private String yearEstablished;
    private String headquarters;
    private String ceo;
    private String industry;
    private String marketValue;
    private String annualSalesVolume;
    private String annualSalesProfit;
    private String numbeOfEmployees;
    private String numberOfCustomer;

    @Id @GeneratedValue(strategy=IDENTITY) @SearchableId    
    public Long getId() {
        return this.id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }

    @Column(name="version")
    @SearchableProperty
    public Integer getVersion() {
        return this.version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    @Column(name="name", nullable=false, length=100)
    @SearchableProperty
    public String getName() {
        return this.name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    @Column(name="comments", length=254)
    @SearchableProperty
    public String getComments() {
        return this.comments;
    }
    
    public void setComments(String comments) {
        this.comments = comments;
    }
    
    @Column(name="description", length=254)
    @SearchableProperty
    public String getDescription() {
        return this.description;
    }
    
    public void setDescription(String description) {
        this.description = description;
    }
    
    @Column(name="company_type")
    @SearchableProperty
    public Integer getCompanyType() {
        return this.companyType;
    }
    
    public void setCompanyType(Integer companyType) {
        this.companyType = companyType;
    }
    
    @Column(name="website", length=100)
    @SearchableProperty
    public String getWebsite() {
        return this.website;
    }
    
    public void setWebsite(String website) {
        this.website = website;
    }
    
    @Column(name="phone", length=50)
    @SearchableProperty
    public String getPhone() {
        return this.phone;
    }
    
    public void setPhone(String phone) {
        this.phone = phone;
    }
    
    @Column(name="logo", length=254)
    @SearchableProperty
    public String getLogo() {
        return this.logo;
    }
    
    public void setLogo(String logo) {
        this.logo = logo;
    }
    
    @Column(name="year_established", length=50)
    @SearchableProperty
    public String getYearEstablished() {
        return this.yearEstablished;
    }
    
    public void setYearEstablished(String yearEstablished) {
        this.yearEstablished = yearEstablished;
    }
    
    @Column(name="headquarters", length=254)
    @SearchableProperty
    public String getHeadquarters() {
        return this.headquarters;
    }
    
    public void setHeadquarters(String headquarters) {
        this.headquarters = headquarters;
    }
    
    @Column(name="ceo", length=50)
    @SearchableProperty
    public String getCeo() {
        return this.ceo;
    }
    
    public void setCeo(String ceo) {
        this.ceo = ceo;
    }
    
    @Column(name="industry", length=254)
    @SearchableProperty
    public String getIndustry() {
        return this.industry;
    }
    
    public void setIndustry(String industry) {
        this.industry = industry;
    }
    
    @Column(name="market_value", length=50)
    @SearchableProperty
    public String getMarketValue() {
        return this.marketValue;
    }
    
    public void setMarketValue(String marketValue) {
        this.marketValue = marketValue;
    }
    
    @Column(name="annual_sales_volume", length=50)
    @SearchableProperty
    public String getAnnualSalesVolume() {
        return this.annualSalesVolume;
    }
    
    public void setAnnualSalesVolume(String annualSalesVolume) {
        this.annualSalesVolume = annualSalesVolume;
    }
    
    @Column(name="annual_sales_profit", length=50)
    @SearchableProperty
    public String getAnnualSalesProfit() {
        return this.annualSalesProfit;
    }
    
    public void setAnnualSalesProfit(String annualSalesProfit) {
        this.annualSalesProfit = annualSalesProfit;
    }
    
    @Column(name="numbe_of_employees", length=50)
    @SearchableProperty
    public String getNumbeOfEmployees() {
        return this.numbeOfEmployees;
    }
    
    public void setNumbeOfEmployees(String numbeOfEmployees) {
        this.numbeOfEmployees = numbeOfEmployees;
    }
    
    @Column(name="number_of_customer", length=50)
    @SearchableProperty
    public String getNumberOfCustomer() {
        return this.numberOfCustomer;
    }
    
    public void setNumberOfCustomer(String numberOfCustomer) {
        this.numberOfCustomer = numberOfCustomer;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Brand pojo = (Brand) o;

        if (name != null ? !name.equals(pojo.name) : pojo.name != null) return false;
        if (comments != null ? !comments.equals(pojo.comments) : pojo.comments != null) return false;
        if (description != null ? !description.equals(pojo.description) : pojo.description != null) return false;
        if (companyType != null ? !companyType.equals(pojo.companyType) : pojo.companyType != null) return false;
        if (website != null ? !website.equals(pojo.website) : pojo.website != null) return false;
        if (phone != null ? !phone.equals(pojo.phone) : pojo.phone != null) return false;
        if (logo != null ? !logo.equals(pojo.logo) : pojo.logo != null) return false;
        if (yearEstablished != null ? !yearEstablished.equals(pojo.yearEstablished) : pojo.yearEstablished != null) return false;
        if (headquarters != null ? !headquarters.equals(pojo.headquarters) : pojo.headquarters != null) return false;
        if (ceo != null ? !ceo.equals(pojo.ceo) : pojo.ceo != null) return false;
        if (industry != null ? !industry.equals(pojo.industry) : pojo.industry != null) return false;
        if (marketValue != null ? !marketValue.equals(pojo.marketValue) : pojo.marketValue != null) return false;
        if (annualSalesVolume != null ? !annualSalesVolume.equals(pojo.annualSalesVolume) : pojo.annualSalesVolume != null) return false;
        if (annualSalesProfit != null ? !annualSalesProfit.equals(pojo.annualSalesProfit) : pojo.annualSalesProfit != null) return false;
        if (numbeOfEmployees != null ? !numbeOfEmployees.equals(pojo.numbeOfEmployees) : pojo.numbeOfEmployees != null) return false;
        if (numberOfCustomer != null ? !numberOfCustomer.equals(pojo.numberOfCustomer) : pojo.numberOfCustomer != null) return false;

        return true;
    }

    public int hashCode() {
        int result = 0;
        result = (name != null ? name.hashCode() : 0);
        result = 31 * result + (comments != null ? comments.hashCode() : 0);
        result = 31 * result + (description != null ? description.hashCode() : 0);
        result = 31 * result + (companyType != null ? companyType.hashCode() : 0);
        result = 31 * result + (website != null ? website.hashCode() : 0);
        result = 31 * result + (phone != null ? phone.hashCode() : 0);
        result = 31 * result + (logo != null ? logo.hashCode() : 0);
        result = 31 * result + (yearEstablished != null ? yearEstablished.hashCode() : 0);
        result = 31 * result + (headquarters != null ? headquarters.hashCode() : 0);
        result = 31 * result + (ceo != null ? ceo.hashCode() : 0);
        result = 31 * result + (industry != null ? industry.hashCode() : 0);
        result = 31 * result + (marketValue != null ? marketValue.hashCode() : 0);
        result = 31 * result + (annualSalesVolume != null ? annualSalesVolume.hashCode() : 0);
        result = 31 * result + (annualSalesProfit != null ? annualSalesProfit.hashCode() : 0);
        result = 31 * result + (numbeOfEmployees != null ? numbeOfEmployees.hashCode() : 0);
        result = 31 * result + (numberOfCustomer != null ? numberOfCustomer.hashCode() : 0);

        return result;
    }

    public String toString() {
        StringBuffer sb = new StringBuffer(getClass().getSimpleName());

        sb.append(" [");
        sb.append("id").append("='").append(getId()).append("', ");
        sb.append("name").append("='").append(getName()).append("', ");
        sb.append("comments").append("='").append(getComments()).append("', ");
        sb.append("description").append("='").append(getDescription()).append("', ");
        sb.append("companyType").append("='").append(getCompanyType()).append("', ");
        sb.append("website").append("='").append(getWebsite()).append("', ");
        sb.append("phone").append("='").append(getPhone()).append("', ");
        sb.append("logo").append("='").append(getLogo()).append("', ");
        sb.append("yearEstablished").append("='").append(getYearEstablished()).append("', ");
        sb.append("headquarters").append("='").append(getHeadquarters()).append("', ");
        sb.append("ceo").append("='").append(getCeo()).append("', ");
        sb.append("industry").append("='").append(getIndustry()).append("', ");
        sb.append("marketValue").append("='").append(getMarketValue()).append("', ");
        sb.append("annualSalesVolume").append("='").append(getAnnualSalesVolume()).append("', ");
        sb.append("annualSalesProfit").append("='").append(getAnnualSalesProfit()).append("', ");
        sb.append("numbeOfEmployees").append("='").append(getNumbeOfEmployees()).append("', ");
        sb.append("numberOfCustomer").append("='").append(getNumberOfCustomer()).append("'");
        sb.append("]");
      
        return sb.toString();
    }

}
